﻿using BTS.Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace BTS.Helpers.DataBaseHelper
{
    public interface IDataBase
    {
        /// <summary>
        /// 创建数据表 
        /// </summary>
        /// <param name="CreateCmd"></param>
        /// <returns></returns>
        bool CreateTable(string Table, string CreateCmd);

        /// <summary>
        /// 获取所有字段名
        /// </summary>
        /// <returns></returns>
        string[] GetAllColumnsName(string Table);

        /// <summary>
        /// 添加字段
        /// </summary>
        /// <param name="Cols"></param>
        /// <returns></returns>
        bool AddColumnName(string Table, DBColumnModel[] Cols);

        /// <summary>
        /// 插入语句 (column1, column2, column3) VALUES (value1, value2, value3);
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        bool Insert(string Table, string query);

        /// <summary>
        /// 删除语句 item='umbrella'
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        bool Delete(string Table, string query);

        /// <summary>
        /// 清空数据表
        /// </summary>
        ///  <returns></returns>
        bool Clear(string Table);

        /// <summary>
        /// 修改语句 列名1 = 新值1, 列名2 = 新值2 WHERE 条件
        /// </summary>
        /// <param name="query"></param>
        ///  <returns></returns>
        bool Update(string Table, string query);

        /// <summary>
        /// 查询所有数据
        /// </summary>
        ///  <returns></returns>
        DataTable QueryAll(string Table);

        /// <summary>
        /// 筛选数据 已包含 SELECT
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        DataTable QuerySomething(string query);

        /// <summary>
        /// 返回数据总数
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        int GetTotalRows(string query);

        /// <summary>
        /// 压缩数据库
        /// </summary>
        /// <returns></returns>
        bool Compress();

        bool CreateNewDBFile(string dbFilePath,string PSW);


    }
}
